<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3.1练习</title>

    <style>
        .box {
            position: relative;
            width: 75px;
            height: 85px;
            border: 1px solid #CCC;
            margin: 100px auto;
            text-align: center;
            font-size: 12px;
            color: #f40;
        }

        .box img {
            width: 60px;
            margin-top: 3px;
        }

        .box .close-btn {
            position: absolute;
            left: -17px;
            top: -1px;
            border: 1px solid #CCC;
            width: 15px;
            height: 15px;

        }
    </style>
</head>

<body>
    <div class="box">
        淘宝二维码
        <img src="./img\tao.png" alt="">
        <i class="close-btn">×</i>
    </div>

    <script>
        var box = document.querySelector('.box');
        var btn = document.querySelector('.close-btn');
        btn.onclick = function () {
            box.style.display = 'none'
        }
    </script>

</body>

</html>